/**
 * 
 */
package com.pocketsweet.model;

import com.avos.avoscloud.AVClassName;
import com.avos.avoscloud.AVFile;
import com.avos.avoscloud.AVObject;
import com.pocketsweet.service.UserService;

/**
 * @author Kam
 * 
 */
@AVClassName("MLVoice")
public class MLVoice extends AVObject {
	public static final String THEME = "theme";
	public static final String TIME = "time";
	public static final String VOICE = "voice";
	public static final String BELONG_TO = "belong_to";

	public MLVoice() {
		setBelongTo(UserService.getCurrentUser());
	}

	// //////////////////////////////////////////
	// 外键 声音所有者
	// //////////////////////////////////////////
	public MLUser getBelongTo() {
		return (MLUser) super.getAVUser(BELONG_TO);
	}

	public void setBelongTo(MLUser user) {
		super.put(BELONG_TO, user);
	}

	// //////////////////////////////////////////
	// get
	// //////////////////////////////////////////

	public String getTheme() {
		return super.getString(THEME);
	}

	public void setTheme(String value) {
		super.put(THEME, value);
	}
	
	public int getTime() {
		return super.getInt(TIME);
	}
	
	public void setTime(int value) {
		super.put(TIME, value);
	}

	public AVFile getVoice() {
		return super.getAVFile(VOICE);
	}

	public void setVoice(AVFile value) {
		super.put(VOICE, value);
	}

	public String getVoiceUrl() {
		AVFile voice = getVoice();
		if (voice != null) {
			return voice.getUrl();
		} else {
			return null;
		}
	}
}
